
module.exports = {
  
  mode: 'spa',
  /*
  ** Headers of the page
  */
  head: {
    title: '打分',
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      { hid: 'description', name: 'description', content: process.env.npm_package_description || '' }
    ],
    link: [
      { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
    ]
  },
  /*
  ** Customize the progress-bar color
  */
  loading: { color: '#fff' },
  /*
  ** Global CSS
  */
  css: [
    "ant-design-vue/dist/antd.less",
    "@/assets/style/main.less"
  ],
  server: {
    port: 8900,
    host: '0.0.0.0' //可用ip访问本地
  },
  /*
  ** Plugins to load before mounting the App
  */
  plugins: [
    '@/plugins/antd-ui',
    {
      src: '~/api/apiList.js',
      ssr: false
    },
    {
      src: '@/plugins/windowResize.js',
      ssr: false
    },
    {
      src: '@/plugins/notification.js',
      ssr: false
    },
  ],
  /*
  ** Nuxt.js dev-modules
  */
  buildModules: [
  ],
  /*
  ** Nuxt.js modules
  */
  modules: [
    '@nuxtjs/style-resources',
    // Doc: https://buefy.github.io/#/documentation
    '@nuxtjs/proxy'
  ],
  styleResources: {
    less: './assets/style/theme.less',
    // sass: ...
  },
  /*
  ** Build configuration
  */
  build: {
    /*
    ** You can extend webpack config here
    */
    extend (config, ctx) {
    },
    filenames: {
      app: ({ isDev }) => isDev ? '[name].js' : 'app/[chunkhash].js',
      chunk: ({ isDev }) => isDev ? '[name].js' : 'chunk/[chunkhash].js',
      css: ({ isDev }) => isDev ? '[name].css' : 'styles/[contenthash].css',
      img: ({ isDev }) => isDev ? '[path][name].[ext]' : 'img/[hash:7].[ext]',
      font: ({ isDev }) => isDev ? '[path][name].[ext]' : 'fonts/[hash:7].[ext]',
      video: ({ isDev }) => isDev ? '[path][name].[ext]' : 'videos/[hash:7].[ext]'
    },
    loaders: {
      less: {
        modifyVars: {
          "primary-color": "#1890ff"
        },
        javascriptEnabled: true
      }
    }
  },
  router: {
    mode: 'hash',
    extendRoutes (routes, resolve) {
      routes.push({ path: '/', redirect: '/score' })
    },
    base: './'
  },
  axios: {
    proxy: true,
    prefix: '/api', // baseURL
    credentials: true,
  },
  proxy: {
    '/api': {
      // target: 'http://az3u67.natappfree.cc/api', // 代理地址
      // target: 'http://www.mlrb.com/api', // 代理地址
      target: 'http://pf.czszjs.com/api', // 内网代理地址
      // target: 'http://mlrb.mulaitek.com/api', // 正式地址

      changeOrigin: true,
      pathRewrite: {
        '^/api': '', //将 /api 替换掉
      },
    },
    '/uploads': {
      target: 'http://pf.czszjs.com/uploads', // 内网代理地址
      changeOrigin: true,
      pathRewrite: {
        '^/uploads': '', //将 /api 替换掉
      },
    }
  }
}
